package com.example.nacosconsumer.controller;

import com.example.nacosconsumer.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestController {
    @Autowired
    TestService testService;

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping(value = "/test/{string}")
    public String test(@PathVariable String string){
        return testService.test(string);
    }

    @GetMapping("/test2/{string}")
    public String test2(@PathVariable String string) {
        return restTemplate.getForObject("http://nacosprovider/test/" + string, String.class);
    }

}
